public class JavaException {
    public static void main(String[] args) {
        try {
            new Thread(() -> {
                int i = 10 / 0;
            }).start();
        } catch (Exception e) {
            System.out.println("子线程发生了异常");
        }
    }

    private static Object extracted0() {
        return 10 / 0;
    }

    /**
     * try-catch-finally 中，如果 catch 中 return 了，finally 还会执行吗？
     * 执行下面方法返回的是什么
     */
    private static String extracted1() {
        try {
            int i = 10 / 0;
            return "ok";
        } catch (Exception e) {
            System.out.println("exception");
            return "exception";
        } finally {
            System.out.println("finally");
            return "finally";
        }
    }

    /**
     * 一下方法返回
     *
     * @return
     */
    private static String extracted2() {
        try {
            return "ok";
        } catch (Exception e) {
            System.out.println("exception");
            return "exception";
        } finally {
            System.out.println("finally");
            return "finally";
        }
    }
}
